package cn.yunhe.entity;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "t_admin")
public class Admin implements Serializable {
    private Integer id;
    private String username;
    private String password;
    private Integer role;
    private Emp emp;

    public Admin() {
    }

    public Admin(String username, String password, Integer role) {
        this.username = username;
        this.password = password;
        this.role = role;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "username")
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Column(name = "password")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Column(name = "role")
    public Integer getRole() {
        return role;
    }

    public void setRole(Integer role) {
        this.role = role;
    }

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "empid")
    public Emp getEmp() {
        return emp;
    }

    public void setEmp(Emp emp) {
        this.emp = emp;
    }
}
